package ChatRoom;

import java.awt.Button;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextArea;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.Socket;

public class MultiUsrChat {

	Frame f_multi = null;
	TextArea ta_multi_all = null;
	Label l_multi = null;
	TextArea ta_multi_input = null;
	Button bt_multi = null;
	
	DataInputStream dis = null;
	DataOutputStream dos = null;
	
	void launchFrame(Socket sk, String[] users){

		String frameName = null;
		for(int i=0; i < users.length; i++){
			frameName += users[i];
		}
		f_multi = new Frame("to : " + frameName);
		f_multi.setBounds(300, 150, 700, 500);
		
		ta_multi_all = new TextArea();
		ta_multi_all.setBounds(7, 27, 685, 300);
		ta_multi_all.setEditable(false);
		
		ta_multi_input = new TextArea();
		ta_multi_input.setBounds(7, 324, 685, 130);
				
		l_multi = new Label();
		l_multi.setBounds(80, 100, 20, 20);
		
		bt_multi = new Button("Send");
		bt_multi.setBounds(600, 460, 80, 30);

		f_multi.add(ta_multi_all);
		f_multi.add(ta_multi_input);
		f_multi.add(l_multi);
		f_multi.add(bt_multi);
		f_multi.add(new Label("")); // without this, upper components' layout is strange, why???

		f_multi.addWindowListener(new WindowAdapter() {

			public void windowClosing(WindowEvent arg0) {
				System.exit(0);
			}

		});

		f_multi.setResizable(false);
		f_multi.setVisible(true);
	}
	
	/*public static void main(String[] xxx){
		Socket s = null;
		new MultiUsrChat().launchFrame(s, xxx);
	}*/
}
